/// @tags:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <vector>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  std::vector<uint> A(n), B(n);
  for (auto& a : A) cin >> a;
  uint ans = 0;
  for (uint i = 1u << 31; i > 0; i >>= 1) {
    for (int j = 0; j < n; ++j) {
      B[j] = ans + i;
      for (uint l = 1ll << 31; l > 0; l >>= 1) {
        if ((B[j] & l) == 0 && (B[j] | (l - 1)) < A[j]) {
          B[j] += l;
        }
      }
      B[j] -= A[j];
    }
    std::sort(B.begin(), B.end());
    if (std::accumulate(B.begin(), B.begin() + k, 0ll) <= m) ans += i;
  }
  cout << ans << endl;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("B.in", "r", stdin);
  freopen("B.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
